{% extends "admin/base_site.html" %}
{% load i18n static %}
{% load admin_urls %}

{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
{% endblock %}

{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/dist/css/app.css" %}">
{% endblock %}

{% block bodyclass %}{{ block.super }} {{ opts.app_label }}-{{ opts.model_name }} change-form{% endblock %}
{% if not is_popup %}
{% block breadcrumbs %}
<ol class="breadcrumb">
    <li><a href="{% url 'admin:index' %}"><i class="fa fa-dashboard"></i> {% trans 'Home' %}</a></li>
    <li><a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a></li>
    <li><a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a></li>
    <li><a href="{% url opts|admin_urlname:'change' original.pk|admin_urlquote %}">{{ original|truncatewords:"18" }}</a></li>
    <li class="active">{% trans 'Change password' %}</li>
</ol>
{% endblock %}
{% endif %}

{% block content_title %} {% trans 'Change password' %} {% endblock %}

{% block content %}

<div class="row">
    <div class="col-md-12">
        <div class="box box-primary">
            <div class="box-header with-border">
                <h4 class="box-title">
                    <p>{% blocktrans with username=original %}Enter a new password for the user <strong>{{ username }}</strong>.{% endblocktrans %}</p>
                </h4>
            </div>

            <div class="box-body">
                <div id="content-main">
                    <form action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form">{% csrf_token %}{% block form_top %}{% endblock %}
                        <input type="text" name="username" value="{{ original.get_username }}" style="display: none">
                        <div>
                            {% if is_popup %}<input type="hidden" name="_popup" value="1">{% endif %}
                            {% if form.errors %}
                            <div class="errornote text-red text-center" style="margin: 20px;">
                                {% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
                            </div>
                            {% endif %}

                            <fieldset class="module aligned">
                                <div class="row form-group">
                                    <div class="col-md-2">
                                        <label class="control-label pull-right">
                                            {{ form.password1.field.label }}
                                        </label>
                                    </div>
                                    <div class="col-md-6">
                                        {{ form.password1 }}
                                        {% if form.password1.help_text %}
                                        <div class="help-block">{{ form.password1.help_text|safe }}</div>
                                        {% endif %}
                                    </div>
                                    <div class="col-md-4">
                                        <div class="help-block text-red">
                                            {{ form.password1.errors }}
                                        </div>
                                    </div>
                                </div>

                                <div class="row form-group">
                                    <div class="col-md-2">
                                        <label class="control-label pull-right">
                                            {{ form.password2.field.label }}
                                        </label>
                                    </div>
                                    <div class="col-md-6">
                                        {{ form.password2 }}
                                        {% if form.password2.help_text %}
                                        <div class="help-block">{{ form.password2.help_text|safe }}</div>
                                        {% endif %}
                                    </div>
                                    <div class="col-md-4">
                                        <div class="help-block text-red">
                                            {{ form.password2.errors }}
                                        </div>
                                    </div>
                                </div>

                            </fieldset>
                            <div class="row">
                                <div class="submit-row col-md-12 col-md-push-2">
                                    <input type="submit" value="{% trans 'Change password' %}" class="btn btn-primary">
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

{% endblock %}

{% block extrajs %}
<script>
    $('[required]').before('<span class="text-red" style="margin-left: -10px;">* </span>');
</script>
{% endblock %}